home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue63 / Clinic / GenValU.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2000-09-08  |  1.7 KB  |  71 lines

  1. unit GenValU;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, Db, Grids, DBGrids, DBTables;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     tblCustomer: TTable;
  12.     dbgCustomer: TDBGrid;
  13.     dsCustomer: TDataSource;
  14.     tblSales: TTable;
  15.     dbgSales: TDBGrid;
  16.     dsSales: TDataSource;
  17.     Label1: TLabel;
  18.     dbIBLOCAL: TDatabase;
  19.     qryGetGenerator: TQuery;
  20.     tblCustomerCUST_NO: TIntegerField;
  21.     tblCustomerCUSTOMER: TStringField;
  22.     tblCustomerCONTACT_FIRST: TStringField;
  23.     tblCustomerCONTACT_LAST: TStringField;
  24.     tblCustomerPHONE_NO: TStringField;
  25.     tblCustomerADDRESS_LINE1: TStringField;
  26.     tblCustomerADDRESS_LINE2: TStringField;
  27.     tblCustomerCITY: TStringField;
  28.     tblCustomerSTATE_PROVINCE: TStringField;
  29.     tblCustomerCOUNTRY: TStringField;
  30.     tblCustomerPOSTAL_CODE: TStringField;
  31.     tblCustomerON_HOLD: TStringField;
  32.     procedure FormCreate(Sender: TObject);
  33.     procedure tblCustomerAfterPost(DataSet: TDataSet);
  34.   private
  35.     { Private declarations }
  36.   public
  37.     function GetCustNoGenValue: Integer;
  38.   end;
  39.  
  40. var
  41.   Form1: TForm1;
  42.  
  43. implementation
  44.  
  45. {$R *.DFM}
  46.  
  47. function TForm1.GetCustNoGenValue: Integer;
  48. begin
  49.   with qryGetGenerator do
  50.   begin
  51.     Open;
  52.     Result := Fields[0].AsInteger;
  53.     Close
  54.   end
  55. end;
  56.  
  57. procedure TForm1.FormCreate(Sender: TObject);
  58. begin
  59.   dbIBLocal.Connected := True;
  60.   Label1.Caption := Format('Generator = %d', [GetCustNoGenValue]);
  61.   tblCustomer.Open;
  62.   tblSales.Open;
  63. end;
  64.  
  65. procedure TForm1.tblCustomerAfterPost(DataSet: TDataSet);
  66. begin
  67.   Label1.Caption := Format('Generator = %d', [GetCustNoGenValue]);
  68. end;
  69.  
  70. end.
  71.